package com.magicborrow.enums;

/**
 * Created by ghost on 16/5/12.
 */
public enum PriceModeEnum {
    A1(0, "次"),
    A2(1, "小时"),
    A3(2, "天"),
    A4(3, "周");
  /*  *//** 商品租借单位 - 次 **//*
    int WARE_PRICE_MODE_0 = 0;

    *//** 商品租借单位 - 小时 **//*
    int WARE_PRICE_MODE_1 = 1;

    */
    /**
     * 商品租借单位 - 天
     **//*
    int WARE_PRICE_MODE_2 = 2;*/
    private int priceMode;
    private String modeStr;

    PriceModeEnum(int priceMode, String modeStr) {
        this.priceMode = priceMode;
        this.modeStr = modeStr;
    }

    public static String getModeStr(int priceMode) {
        for (PriceModeEnum p : PriceModeEnum.values()) {
            if (p.priceMode == priceMode)
                return p.modeStr;
        }
        return "";
    }

    public static int getModeId(String modeStr) {
        for (PriceModeEnum p : PriceModeEnum.values()) {
            if (p.modeStr.equals(modeStr)) {
                return p.priceMode;
            }
        }
        return 0;
    }
}
